<style>   
    .ac_results {
        padding: 0px;
        border: 1px solid black;
        background-color: white;
        overflow: hidden;
        z-index: 99999;
        color: black;
    }

    .ac_results ul {
        width: 100%;
        list-style-position: outside;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .ac_results li {
        margin: 0px;
        padding: 2px 5px;
        cursor: default;
        display: block;
        /* 
        if width will be 100% horizontal scrollbar will apear 
        when scroll mode will be used
        */
        width: 100%;
        font: menu;
        font-size: 12px;
        /* 
        it is very important, if line-height not setted or setted 
        in relative units scroll will be broken in firefox
        */
        line-height: 16px;
        overflow: hidden;
    }

    .ac_loading {
        background: white url('indicator.gif') right center no-repeat;
    }

    .ac_odd {
        background-color: #eee;
    }

    .ac_over {
        background-color: #0A246A;
        color: white;
    }
</style>

<div class="page_title">
    <span class="title_icon"><span class="coverflow"></span></span>
    <h3>Registro</h3>    
</div>
<div id="content">
    <div class="grid_container">
        <div class="grid_12">
            <!--<form action="#" method="post" id="form103" class="form_container left_label valid_tip">-->
            <?php echo $this->Form->create('Paciente', array('id' => "form103", 'class' => "form_container left_label valid_tip")) ?>
            <div class="widget_wrap">
                <div class="widget_top">
                    <span class="h_icon list"></span>
                    <h6>REGISTRO NUEVO PACIENTE</h6>
                </div>
                <div class="widget_content">
                    <span class="clear">&nbsp;&nbsp;sss</span>
                    <div class="form_grid_12">                                             

                        <div class="form_input">
                            <select name="catciede" data-placeholder="Seleccione la Categoria" style="width: 400px;" class="chzn-select-deselect" tabindex="16" id="categoria">
                                <option value="" selected="selected"></option>
                                <?php foreach ($cies as $c): ?>
                                    <option value="<?php echo $c['TiposCiede']['id'] ?>">
                                        <?php echo $c['TiposCiede']['codigo'] ?> - <?php echo $c['TiposCiede']['nombre'] ?>
                                    </option>
                                <?php endforeach; ?>
                            </select>
                        </div>
                    </div>
                    <div id="cargacies">
                    </div>
                    <ul>
                        <li>
                            <div class="form_grid_12">
                                <div class="form_input">
                                    <div class="form_grid_6 alpha">
                                        <div class="form_input">
                                            <select data-placeholder="Seleccione la Categoria" style="width: 300px;" class="chzn-select-deselect" tabindex="16">
                                                <option value=""></option>
                                                <?php foreach ($cies as $c): ?>
                                                    <option value="<?php echo $c['TiposCiede']['id'] ?>">
                                                        <?php echo $c['TiposCiede']['codigo'] ?> - <?php echo $c['TiposCiede']['nombre'] ?>
                                                    </option>
                                                <?php endforeach; ?>
                                            </select>
                                        </div>
                                    </div>                                    
                                    <span class="clear"></span>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="form_grid_12">
                                <label class="field_title">FECHA DE NACIMIENTO Y SEXO</label>
                                <div class="form_input">
                                    <div class="form_grid_4 alpha">
                                        <input name="data[Paciente][fecha_nacimiento]" type="text" id="date" tabindex="1"/>
                                        <span class=" label_intro">FECHA DE NACIMIENTO</span>
                                    </div>
                                    <div class="form_grid_5">
                                        <span>
                                            <input name="data[Paciente][sexo]" class="radio" type="radio" value="F" tabindex="1" selected>
                                            <label class="choice">Femenino</label>
                                        </span><span>
                                            <input name="data[Paciente][sexo]" class="radio" type="radio" value="M" tabindex="1">
                                            <label class="choice">Masculino</label>
                                        </span>
                                        <span class=" label_intro">SEXO</span>
                                    </div>
                                    <div class="form_grid_3">
                                        <?php //echo $this->Form->text('carnet', array())?>
                                        <input name="data[Paciente][carnet]" type="text" class="validate number" tabindex="1"/>
                                        <span class=" label_intro">CARNET DE ID</span>
                                    </div>

                                    <span class="clear"></span>
                                </div>
                            </div>

                        </li>

                        <li>
                            <div class="form_grid_12">
                                <label class="field_title">Lugar de procedencia</label>
                                <div class="form_input">
                                    <span>
                                        <input name="data[Paciente][lugar]" id="lugar1" class="radio" type="radio" value="provincia" tabindex="2" selected>
                                        <label class="choice">Provincia</label>
                                    </span>
                                    <span>
                                        <input name="data[Paciente][lugar]" id="lugar2" class="radio" type="radio" value="ciudad" tabindex="3">
                                        <label class="choice">Ciudad</label>
                                    </span>
                                </div>
                            </div>
                        </li>                                               
                        <li>
                            <div class="form_grid_12">
                                <div class="form_input">

                                    <button type="submit" class="btn_small btn_blue"><span>Guardar paciente</span></button>
                                    <button type="reset" class="btn_small btn_orange"><span>Limpiar datos</span></button>
                                </div>
                            </div>
                        </li>
                        <li>

                        </li>
                    </ul>
                </div>
            </div>
            </form>
        </div>        
        <script>
            $(document).ready(function() {
                $('#categoria').change(function() {
                    //alert('Handler for .change() called.');
                    var categoria = this.value;
                    $("#cargacies").load("<?php echo $this->Html->url(array('controller' => 'Ciedes', 'action' => 'ajaxencuentracies')); ?>/" + categoria);
                    console.log(this.value);
                });

                function parametros()
                {                   
                    var valor = {};
                    valor['text'] = $('input[name="catciede"]').val(); //where zzz is name of your input
                    console.log(valor);
                    return out;                    
                }

            });
        </script>
    </div>
    <span class="clear"></span>    
    <?php echo $this->Form->create('User', array('url' => '/ajax/view')); ?>
    <?php echo $this->Ajax->autoComplete('Ciede.descod4', '/Ciedes/ajaxautocomplete', array('extraParams'=>1 )); ?>
    <?php echo $this->Form->end('View Post'); ?>    
</div>
